Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <p>Click the button to make changes to a list item, using the createDocumentFragment method, then appending the list item as the last child of the list.</p> <ul><li>Coffee</li><li>Tea</li></ul> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var d = document.createDocumentFragment(); d.appendChild(document.getElementsByTagName("LI")[0]); d.childNodes[0].childNodes[0].nodeValue = "Milk"; document.getElementsByTagName("UL")[0].appendChild(d); } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_document_createdocfrag by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:10:39 GMT --> </html>
Result:
Try it Yourself - © w3schools.com